package com.newland.mesdk.demo.moduleinterface;

import java.util.concurrent.TimeUnit;

import com.newland.mtype.event.DeviceEventListener;
import com.newland.mtype.module.common.externalPin.BaudrateType;
import com.newland.mtype.module.common.externalPin.DataBitType;
import com.newland.mtype.module.common.externalPin.ExtTransResult;
import com.newland.mtype.module.common.externalPin.OddEvenCheckType;
import com.newland.mtype.module.common.pin.AccountInputType;
import com.newland.mtype.module.common.pin.EncryptType;
import com.newland.mtype.module.common.pin.KeyManageType;
import com.newland.mtype.module.common.pin.MacAlgorithm;
import com.newland.mtype.module.common.pin.PinInputEvent;
import com.newland.mtype.module.common.pin.StopBitType;
import com.newland.mtype.module.common.pin.WorkingKey;
import com.newland.mtype.module.common.pin.WorkingKeyType;

/**
 * Created by HJP on 2015/8/12.
 */
public interface ExternalPinInputInterface {
	public byte[] calcMac(MacAlgorithm macAlgorithm, WorkingKey wk, byte[] input, int mainKeyIndex);

	public void cancelPinInput();

	
	public byte[] decrypt(WorkingKey wk, EncryptType encryptType, byte[] input, byte[] cbcInit, int mainkeyIndex);

	public byte[] encrypt(WorkingKey wk, EncryptType encryptType, byte[] input, byte[] cbcInit, int mainkeyIndex);

	public ExtTransResult extKeyboardUnvTransmission(int respDataLength, int timeout, TimeUnit timeUnit, byte[] data);

	public byte[] loadMainKey(int mainIndex, byte[] data);

	public byte[] loadWorkingKey(WorkingKeyType type, int mainKeyIndex, int workingKeyIndex, byte[] data);

	public void pinPadPortInit(BaudrateType baudrate, DataBitType dataBit, OddEvenCheckType oddEvenCheck, StopBitType stopBit);

	public PinInputEvent startExternalPinInput(WorkingKey workingKey, KeyManageType keyManageType, AccountInputType acctInputType, String acctSymbol,
			int inputMaxLen, byte[] pinPadding, boolean isEnterEnabled, long timeout, TimeUnit timeunit, int mainKeyIndex);

	public void startExternalPinInput(WorkingKey workingKey, KeyManageType keyManageType, AccountInputType acctInputType, String acctSymbol,
			int inputMaxLen, byte[] pinPadding, boolean isEnterEnabled, long timeout, TimeUnit timeunit, int mainKeyIndex,
			DeviceEventListener<PinInputEvent> inputListener);

}
